home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / dosutils / tsbat50.zip / REPLY.BAT < prev    next >
DOS Batch File  |  1995-09-04  |  1KB  |  42 lines

  1. @echo off
  2.  
  3. echo.
  4. echo ┌────────────────────────────────────────────────────────────────────┐
  5. echo │ Demonstrate that it is possible to give input to a pure batch file │
  6. echo │ By Prof. Timo Salmi, ts@uwasa.fi, Mon 4-September-1995             │
  7. echo └────────────────────────────────────────────────────────────────────┘
  8. echo.
  9.  
  10. rem For an even more inventive method see item #40 in batricks.txt
  11.  
  12. echo Give your reply as set r=YourReply terminated by ^Z (and Enter)
  13. rem Read from the keyboard into a temporary auxiliary file
  14. copy con replytmp.bat > nul
  15.  
  16. rem Set the r environment variable
  17. if exist replytmp.bat call replytmp.bat
  18.  
  19. rem Get rid of the temporary file
  20. del replytmp.bat > nul
  21.  
  22. rem Branch in accordance to the reply
  23. for %%i in (y Y yes YES) do if %%i==%r% goto _yes
  24. for %%i in (n N no NO) do if %%i==%r% goto _no
  25. goto _indef
  26.  
  27. :_yes
  28. echo Your reply was a "Yes"
  29. goto _out
  30.  
  31. :_no
  32. echo Your reply was a "No"
  33. goto _out
  34.  
  35. :_indef
  36. echo Your reply was indefinite
  37.  
  38. rem That's all folks
  39. :_out
  40. set r=
  41. echo on
  42.